<template>
    <GeneralOperationForm
        :navLists="navLists"
    >
        <template #default>
            <div>
                <Section :list="navLists[0]" />
                <Section :list="navLists[1]" />
                <div class="content-box">
                    <div class="content-row-1">
                        <div class="content-row-title-1">行政区划:</div>
                        <div class="content-row-text-1">{{ formData1.orgName }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">机构名称:</div>
                        <div class="content-row-text-1">{{ formData1.name }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">是否和未成年人救助保护中心合署办公:</div>
                        <div class="content-row-text-1">
                            <GeneralOptionValue 
                                :options="GENERAL_OPTIONS_1"
                                :value="formData1.workWithMp"
                            />
                        </div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">统一社会信用代码:</div>
                        <div class="content-row-text-1">{{ formData1.creditCode }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">机构类型:</div>
                        <div class="content-row-text-1">
                            <GeneralOptionValue 
                                :dictionary="GENERAL_REMOTE_OPTIONS[5]"
                                :value="formData1.orgType"
                            />
                        </div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">成立日期:</div>
                        <div class="content-row-text-1">{{ formData1.foundDate }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">事业单位法人证书有效期开始日期:</div>
                        <div class="content-row-text-1">{{ formData1.legalStarttime }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">事业单位法人证书有效期失效日期:</div>
                        <div class="content-row-text-1">{{ formData1.legalEndtime }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">法定代表人:</div>
                        <div class="content-row-text-1">{{ formData1.legalRepresentative }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">院址:</div>
                        <div class="content-row-text-1">{{ formData1.address }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">邮政编码:</div>
                        <div class="content-row-text-1">{{ formData1.postCode }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">咨询电话:</div>
                        <div class="content-row-text-1">{{ formData1.oneNumber }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">咨询电话是否114可查:</div>
                        <div class="content-row-text-1">
                            <GeneralOptionValue 
                                :options="GENERAL_OPTIONS_1"
                                :value="formData1.phoneNumberSearchable"
                            />
                        </div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">传真:</div>
                        <div class="content-row-text-1">{{ formData1.fax }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">负责人:</div>
                        <div class="content-row-text-1">{{ formData1.manager }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">负责人联系电话:</div>
                        <div class="content-row-text-1">{{ formData1.managerPhoneNumber }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">规划床位数:</div>
                        <div class="content-row-text-1">{{ formData1.plannedBedCount }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">核定床位数:</div>
                        <div class="content-row-text-1">{{ formData1.bedCount }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">占地面积:</div>
                        <div class="content-row-text-1">{{ formData1.landArea }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">总投资（万元）:</div>
                        <div class="content-row-text-1">{{ formData1.totalInvestment }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">资金来源:</div>
                        <div class="content-row-text-1">{{ formData1.sourceOfFunds }}</div>
                    </div>
                </div>
                
                <Section :list="navLists[2]" />
                <div class="content-box">
                    <div class="content-row-1">
                        <div class="content-row-title-1">医疗模式:</div>
                        <div class="content-row-text-1">
                            <GeneralOptionValue 
                                :dictionary="GENERAL_REMOTE_OPTIONS[4]"
                                :value="formData1.healthMode"
                            />
                        </div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">内设医疗机构名:</div>
                        <div class="content-row-text-1">{{ formData1.inbuiltMedicalAgencies }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">是否取得执业许可证:</div>
                        <div class="content-row-text-1">
                            <GeneralOptionValue 
                                :options="GENERAL_OPTIONS_1"
                                :value="formData1.isPermit"
                            />
                        </div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">开通绿色通道的合作医疗机构名称:</div>
                        <div class="content-row-text-1">{{ formData1.collaborationMedicalAgencies }}</div>
                    </div>
                </div>
                <Section :list="navLists[3]" />
                <div class="content-box">
                    <div class="content-row-1">
                        <div class="content-row-title-1">康复模式:</div>
                        <div class="content-row-text-1">
                            <GeneralOptionValue 
                                :dictionary="GENERAL_REMOTE_OPTIONS[2]"
                                :value="formData1.convalescentMode"
                            />
                        </div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">定点康复机构名称:</div>
                        <div class="content-row-text-1">{{ formData1.convalescentAgencies }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">服务的残疾类型:</div>
                        <div class="content-row-text-1">
                            <GeneralOptionValue 
                                :dictionary="GENERAL_REMOTE_OPTIONS[0]"
                                :value="formData1.disabilityType"
                            />
                        </div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">初次认定时间:</div>
                        <div class="content-row-text-1">{{ formData1.recognizedDate }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">康复医师数量:</div>
                        <div class="content-row-text-1">{{ formData1.physicianNumber }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">康复治疗师数量:</div>
                        <div class="content-row-text-1">{{ formData1.therapistsNumber }}</div>
                    </div>
                </div>

                <Section :list="navLists[4]" />
                <div class="content-box">
                    <div class="content-row-1">
                        <div class="content-row-title-1">教育模式:</div>
                        <div class="content-row-text-1">
                            <GeneralOptionValue 
                                :dictionary="GENERAL_REMOTE_OPTIONS[3]"
                                :value="formData1.educateMode"
                            />
                        </div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">特教老师人数:</div>
                        <div class="content-row-text-1">{{ formData1.teacherNumber }}</div>
                    </div>
                    <div class="content-row-1">
                        <div class="content-row-title-1">其中编制特教老师人数:</div>
                        <div class="content-row-text-1">{{ formData1.weaveTeacherNumber }}</div>
                    </div>
                </div>
                <Section :list="navLists[5]" />
                <div class="content-box">
                    <div 
                        v-for="(item, index) in formData1.attachments"
                        :key="`attachments-${index}`"
                        class="content-row-1"
                    >
                        <FormUploadImage 
                            v-model:imageStr="item.attachmentName"
                            :title="item.attachmentTitle"
                            :showButton="false"
                        />
                    </div>
                </div>
            </div>
        </template>
        <template #footer>
            <!-- <el-button 
                type="primary"
                @click="goDialogEdit"
            >
                保存
            </el-button> -->
        </template>
    </GeneralOperationForm>
</template>
  
<script lang="ts" setup>
    import { ref, reactive, markRaw, onBeforeMount, onMounted, onBeforeUnmount, nextTick, computed, watch } from 'vue'
    import type { Ref, Raw } from 'vue'
    import { useRoute, useRouter } from 'vue-router'
    import { storeToRefs } from 'pinia'
    import { useStore } from '@/store'
    import { ElMessage } from 'element-plus'
    import {
        Lock,
        User,
        Monitor,
        Phone,
        UploadFilled
    } from '@element-plus/icons-vue'
    import { 
        welfareorgsGetWelfareOrgsInfoApi, 
        welfareorgsAddChildInfoApi,
    } from '@/apis'
    import { getGeneralOptionsLabel } from '@/utils'
    import GeneralOperationForm from '@/components/generalOperationForm/GeneralOperationForm.vue'
    import Section from '@/components/section/Section.vue'
    import AdministrativeDivisionsCascader from '@/components/administrativeDivisionsCascader/AdministrativeDivisionsCascader.vue'
    import FormUploadImage from '@/components/formUploadImage/FormUploadImage.vue'
    import GeneralSelect from '@/components/generalSelect/GeneralSelect.vue'
    import GeneralOptionValue from '@/components/generalOptionValue/GeneralOptionValue.vue'


    import { GENERAL_OPTIONS_1, GENERAL_REMOTE_OPTIONS } from '@/constants'

    const route = useRoute()
    const router = useRouter()
    const store = useStore()
    
    const dialogObj = defineModel<any>('dialogObj', {
        required: false,
        default: {}
    })
    const emits = defineEmits<{
        // (e: 'update:isCollapse', data: boolean): void,
        tabelSearch: [data?: any]
    }>()
    // 侧边栏
    const navLists:Ref<any[]> = ref([
        {
            text: '基本信息',
            id: 'nav-id-1',
            level: 1,
        },
        {
            text: '机构基本信息',
            id: 'nav-id-1-1',
            level: 2,
        },
        {
            text: '医疗情况',
            id: 'nav-id-1-2',
            level: 2,
        },
        {
            text: '定点康复情况',
            id: 'nav-id-1-3',
            level: 2,
        },
        {
            text: '纳入特救系统情况',
            id: 'nav-id-1-4',
            level: 2,
        },
        {
            text: '附件',
            id: 'nav-id-2',
            level: 1,
        },
    ])

    const formData1: Ref<any> = ref({
        orgName: '',
        name: '',
        workWithMp: '',
        creditCode: '',
        orgType: '',
        foundDate: '',
        legalStarttime: '',
        legalEndtime: '',
        legalRepresentative: '',
        address: '',
        postCode: '',
        oneNumber: '',
        phoneNumberSearchable: '',
        fax: '',
        manager: '',
        managerPhoneNumber: '',
        plannedBedCount: '',
        bedCount: '',
        landArea: '',
        totalInvestment: '',
        sourceOfFunds: '',
        healthMode: '',
        inbuiltMedicalAgencies: '',
        isPermit: '',
        collaborationMedicalAgencies: '',
        convalescentMode: '',
        convalescentAgencies: '',
        disabilityType: '',
        recognizedDate: '',
        physicianNumber: '',
        therapistsNumber: '',
        educateMode: '',
        teacherNumber: '',
        weaveTeacherNumber: '',
        attachments: [
            {
                attachmentName: '', //附件地址名称（多个中间用，分割）	
                attachmentTitle: '机构名称', //附件名称 （例如：身份证正面、身份证反面、学位证书、毕业证书、机构附件）
                entitySubType: '', //附件子类型枚举
                entitySubTypeName: '', //附件子类型名称
                id: '',
            }
        ], //https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg,https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg
    })
    
  
    onMounted(async() => {
        // if (dialogObj.value?.dialogParams.id) {
            try {
                let res1: any = await welfareorgsGetWelfareOrgsInfoApi({
                    id: dialogObj.value.dialogParams?.id ? dialogObj.value.dialogParams?.id : ''
                })
                formData1.value = res1.data
            } catch(err) {

            }
        // }
    })

    const goDialogEdit = () => {
        // dialogObj.value.dialogComponent = InstitutionalManagementListEdit
        // dialogObj.value.dialogTitle = '修改'
    }

    
</script>
  
<style lang="scss" scoped>
    .content-box {
        @include general-view-1;
        .content-row-1 {
            @include general-view-row-1;
            .content-row-title-1 {
                @include general-view-row-title-1;
            }
            .content-row-text-1 {
                @include general-view-row-text-1;
            }
        }
        .content-row-2 {
            @include general-view-row-2;
            .content-row-title-1 {
                @include general-view-row-title-1;
            }
            .content-row-text-1 {
                @include general-view-row-text-1;
            }
        }
    }
</style>
